package com.ehotting.mqbd.zw.client.mqAction;

import com.alibaba.fastjson.JSON;
import com.ehotting.eaf.netty.action.Action;
import com.ehotting.eaf.netty.domain.DataAble;
import com.ehotting.mqbd.zw.api.constants.ActionConstants;
import com.ehotting.mqbd.zw.api.domain.netty.task.TaskLauchedReq;
import com.ehotting.mqbd.zw.client.mq.ZwMqActionAble;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Action(ActionConstants.Cmd_TaskLauchedStr)
public class ZwMqTaskLauchedAction implements ZwMqActionAble<TaskLauchedReq> {
    @Override
    public DataAble invoke( TaskLauchedReq request) {
        log.info("receive TaskLauchedReq:{}", JSON.toJSONString(request));
//        request.convertToProp();

        /*byte[] buff = request.getBuff();
        ByteBuf buffer = Unpooled.buffer(buff.length);
        buffer.writeBytes(buff);

        long taskId = buffer.readLong();
        long ip = buffer.readUnsignedInt();
        long port = buffer.readUnsignedInt();
        log.info("receive TaskLauchedReq:ip is {}",IpUtils.intToIpv4((int) ip));*/
//        String token = ZwTcpCache.taskIdTokenMap.get(taskId);
//        ZwTcpCache.ipTokenMap.put(IpUtils.intToIpv4((int) ip),token);

        return null;
    }

    @Override
    public Class<?> getRequestClass() {
        return TaskLauchedReq.class;
    }
}
